package com.teatrace.model.pack;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.teatrace.model.base.Device;
import com.teatrace.model.base.Employee;


@Entity
@Table(name="particle_product")
public class ParticleProduct {

	@Id
	@Column(name="particle_product_id")
	private int particleProductId;
	private String weight;
	private String quality;
	
	@Column(name="semifinished_product_package_id")
	private long semifinishedProductPackageId;//
	
	@Column(name="pack_time",columnDefinition="datetime")
	private String packTime;
	private String wrapper;
	private String description;
	private boolean deleted;
	@Column(nullable=false)
	private int isPar; //记录是否已经经过粒子包装
	
	@ManyToMany
	@JoinTable(
		name="r_employee_particleproduct",
		joinColumns={@JoinColumn(name="particle_product_id")},
		inverseJoinColumns={@JoinColumn(name="employee_id")}
	)
	private Set<Employee> emps;
	
	

	@ManyToMany(cascade={CascadeType.ALL})
	@JoinTable(
		name="r_device_particleproduct",
		joinColumns={@JoinColumn(name="particle_product_id")},
		inverseJoinColumns={@JoinColumn(name="device_id")}
	)
	private Set<Device> devices;


	public String getWeight() {
		return weight;
	}
	public String getQuality() {
		return quality;
	}


	public String getWrapper() {
		return wrapper;
	}
	public String getDescription() {
		return description;
	}
	public boolean isDeleted() {
		return deleted;
	}

	public void setWeight(String weight) {
		this.weight = weight;
	}
	public void setQuality(String quality) {
		this.quality = quality;
	}


	public void setWrapper(String wrapper) {
		this.wrapper = wrapper;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	public void setParticleProductId(int particleProductId) {
		this.particleProductId = particleProductId;
	}
	public int getParticleProductId() {
		return particleProductId;
	}
	public void setPackTime(String packTime) {
		this.packTime = packTime;
	}
	public String getPackTime() {
		return packTime;
	}
	public void setSemifinishedProductPackageId(long semifinishedProductPackageId) {
		this.semifinishedProductPackageId = semifinishedProductPackageId;
	}
	public long getSemifinishedProductPackageId() {
		return semifinishedProductPackageId;
	}
	public void setEmps(Set<Employee> emps) {
		this.emps = emps;
	}
	public Set<Employee> getEmps() {
		return emps;
	}
	public void setDevices(Set<Device> devices) {
		this.devices = devices;
	}
	public Set<Device> getDevices() {
		return devices;
	}
	public int getIsPar() {
		return isPar;
	}
	public void setIsPar(int isPar) {
		this.isPar = isPar;
	}
}
